package ProtectThread;

public class ProtectThreadTest {
    public static void main(String[] args) {
        Thread t1 = new Thread(new ProtectThread1());
        Thread t2 = new Thread(new ProtestThread02());
        t1.setName("守护线程p1");
        t2.setName("守护线程p2");
        t2.setDaemon(true);//设置守护线程后main结束后守护线程也会结束
        t1.setDaemon(true);
        t1.start();
        t2.start();
        try {
            Thread.sleep(1000 * 10 * 10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
